#ifndef ORDER_H
#define ORDER_H
#include "ticket.h"
#include <string>
#include <vector>
#include <iostream>  // 添加iostream头文件
#include <fstream>  // 添加fstream头文件

// 使用std命名空间
using std::string;
using std::vector;
using std::ostream;
using std::istream;

// 前向声明
class OrderList;

class Order{
private:
    string trainID;
    string passengerName;
    string passengerID;
    string phoneNumber;
    int orderID;

public:
    Order(const string& _trainID, const string& _passengerName, const string& _passengerID, const string& _phoneNumber);
    Order();

    int getOrderID() const {return orderID;};
    string getTrainID() const{return trainID;};
    string getPassengerName() const{return passengerName;};
    string getPassengerID() const{return passengerID;};
    string getPhoneNumber() const{return phoneNumber;};

    void setOrderID(const int& _orderID){orderID = _orderID;};
    void showOrderInfo();
};

class OrderList{
private:
    vector<Order> orders;
    int nextId = 1;
public:
    OrderList();
    void addOrder(Order& order);
    int getNextID(){return nextId;};

    void searchOrder(const int& orderID);
    void showAllOrders();

    void saveOrders2File();
    void loadOrdersFromFile();
};

#endif
